﻿CREATE FUNCTION [dbo].[fn_ColumnIsTimestamp]
(
	@Table   sysname,
	@Column  sysname
)
RETURNS BIT
AS
BEGIN	
	DECLARE @True  BIT; SET @True  = 1
	DECLARE @False BIT; SET @False = 0
	
	IF (
	       SELECT ty.[name]
	       FROM   sys.tables t
	              INNER JOIN sys.[columns] c
	                   ON  t.[object_id] = c.[object_id]
	              INNER JOIN sys.types ty
	                   ON  c.user_type_id = ty.user_type_id
	       WHERE  t.[name] = @Table
	              AND c.[name] = @Column
	              AND t.[type] = 'U'
	   ) = 'TIMESTAMP'
	    RETURN @True
	
	RETURN @False
END